package com.ithema.comfig;

import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.context.annotation.Bean;

import javax.sql.DataSource;


public class MybatisConfig {
    @Bean
    public SqlSessionFactoryBean sqlSessionFactoryBean(DataSource source){
        SqlSessionFactoryBean sqt = new SqlSessionFactoryBean();
        sqt.setDataSource(source);
        sqt.setTypeAliasesPackage("com.ithema.pojo");
        return sqt;
    }

    @Bean
    public MapperScannerConfigurer mapperScannerConfigurer(){
        MapperScannerConfigurer msc = new MapperScannerConfigurer();
        msc.setBasePackage("com.ithema.dao");
        return msc;
    }
}
